package com.zjdiepu.www.commpent.mapper.other;

import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.stereotype.Component;

import com.zjdiepu.www.base.core.BaseMapper;
import com.zjdiepu.www.base.enums.status.DpStatus;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.model.base.dto.SimpleDataDictionary;
import com.zjdiepu.www.model.other.dto.OtherBankRate;
import com.zjdiepu.www.util.CachedEnums;
/**
 * 项目名称：diepu-parent-biz <br/> 
 * 类名称：OtherBankRateVoMapper <br/>  
 * 类描述：银行利率 <br/>    
 * 创建人：xiongxiaotun <br/> 
 * 创建时间：2017年5月24日 上午11:29:13  <br/>   
 * 修改人：xiongxiaotun <br/> 
 * 修改时间：2017年5月24日 上午11:29:13   <br/>  
 * 修改备注：    <br/> 
 * @version V1.0   <br/>
 */
@Component
public class OtherBankRateVoMapper extends BaseMapper<OtherBankRate>{
	
	@Override
	public void mapper(RedisConnection redisConnection,OtherBankRate m) {
		if(null == m) {
			return;
		}
		Integer dpStatus = m.getDpStatus();
		m.setDpStatusDisplay((String)CachedEnums.getValue(dpStatus, DpStatus.class));
		
		Integer monthNum = m.getMonthNum();
		SimpleDataDictionary monthNumDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), String.valueOf(monthNum), DataDicType.LOAN_MONTH.getCode());
		m.setMonthNumDisplay(monthNumDic == null ? null : monthNumDic.getName());
		
		String bankCode = m.getBankCode();
		SimpleDataDictionary bankCodeDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), bankCode, DataDicType.LOAN_BANK.getCode());
		m.setBankCodeDisplay(bankCodeDic == null ? null : bankCodeDic.getName());
	}
}
